<html>

<head>
<title>插入表格</title>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="popup.js"></script>

<script type="text/javascript">

window.resizeTo(400, 100);

function Init() {
  __dlg_init();
  document.getElementById("f_rows").focus();
};

function onOK() {
  var required = {
    "f_rows": "必须输入行数",
    "f_cols": "必须输入列数"
  };
  for (var i in required) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(required[i]);
      el.focus();
      return false;
    }
  }
  var fields = ["f_rows", "f_cols", "f_width", "f_unit",
                "f_align", "f_border", "f_spacing", "f_padding", "f_bgcolor", "f_bordercolor", "f_tdwidth", "f_tdbgcolor"];
  var param = new Object();
  for (var i in fields) {
    var id = fields[i];
    var el = document.getElementById(id);
    param[id] = el.value;
  }
  __dlg_close(param);
  return false;
};

function onCancel() {
  __dlg_close(null);
  return false;
};

function foreColor(formobj)
{
  if (!Error())	return;
  var arr = showModalDialog("../selcolor.html", "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0");
  if (arr != null) {
  	if(formobj==0){
  		document.instable.bgcolor.value=arr;
	}
	else if(formobj==2)
	{
		document.instable.tdbgcolor.value=arr;
	}
	else{
		document.instable.bordercolor.value=arr;
	}
  }
  else {
  	if(formobj==0){
  		document.instable.bgcolor.focus();
	}
	else if(formobj==2)
	{
		document.instable.tdbgcolor.focus();
	}
	else{
		document.instable.bordercolor.focus();
	}
  }
}
</script>

<style type="text/css">
html, body {
  background: ButtonFace;
  color: ButtonText;
  font: 11px Tahoma,Verdana,sans-serif;
  margin: 0px;
  padding: 0px;
}
body { padding: 5px; }
table {
  font: 11px Tahoma,Verdana,sans-serif;
}
form p {
  margin-top: 5px;
  margin-bottom: 5px;
}
.fl { width: 6em; float: left; padding: 2px 5px; text-align: right; }
.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
fieldset { padding: 0px 10px 5px 5px; }
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
.space { padding: 2px; }

.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
border-bottom: 1px solid black; letter-spacing: 2px;
}
form { padding: 0px; margin: 0px; }
</style>

</head>

<body onload="Init()">


<form action="" method="get" name="instable">
  <table border="0" style="padding: 0px; margin: 0px">
    <tbody>
      <tr> 
        <td width="42" style="width: 4em; text-align: right">行:</td>
        <td width="34"><input type="text" name="rows" id="f_rows" size="5" value="2" /></td>
        <td><div align="right">背景色:</div></td>
        <td colspan="2"> <input name="bgcolor" type="text" id="f_bgcolor" size="8"> 
          <a onclick="foreColor(0);"><img src="../../../data/images/color.gif" width="21" height="21" align="absbottom"></a> 
          边框色: 
          <input name="bordercolor" type="text" id="f_bordercolor" size="8"> <a onclick="foreColor(1);"><img src="../../../data/images/color.gif" width="21" height="21" align="absbottom"></a></td>
      </tr>
      <tr> 
        <td style="width: 4em; text-align: right">列:</td>
        <td><input type="text" name="cols" id="f_cols" size="5" value="4" /></td>
        <td width="44" style="width: 4em; text-align: right">宽度:</td>
        <td width="59"><input type="text" name="width" id="f_width" size="8" value="100" /></td>
        <td width="137"><select size="1" name="unit" id="f_unit" title="Width unit">
            <option value="%" selected="1"  >百分比</option>
            <option value="px"              >象素</option>
            <option value="em"              >英寸</option>
          </select></td>
      </tr>
      <tr> 
        <td style="width: 4em; text-align: right">&nbsp;</td>
        <td><div align="right">单元格:</div></td>
        <td><div align="right">大小:</div></td>
        <td colspan="2"><input type="text" name="tdwidth" id="f_tdwidth" size="8" />
          背景色: 
          <input name="tdbgcolor" type="text" id="f_tdbgcolor" size="8"> <a onclick="foreColor(2);"><img src="../../../data/images/color.gif" width="21" height="21" align="absbottom"></a></td>
      </tr>
    </tbody>
  </table>

<p />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<fieldset style="float: left; margin-left: 5px;">
<legend>布局</legend>

<div class="space"></div>

<div class="fl">对齐方式:</div>
<select size="1" name="align" id="f_align">
  <option value="" selected="1"                >默认</option>
  <option value="left"                         >左对齐</option>
  <option value="right"                        >右对齐</option>
  <option value="center"                       >居中</option>
  <option value="bottom"                       >底边</option>
  <option value="top"                          >顶端</option>
  <option value="texttop"                      >文本上方</option>
  <option value="absmiddle"                    >绝对垂直居中</option>
  <option value="baseline"                     >基线</option>
  <option value="absbottom"                    >绝对底边对齐</option>
</select>

<p />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<div class="fl">边框粗细:</div>
<input type="text" name="border" id="f_border" size="5" value="1"
title="留空则无边框" />

<div class="space"></div>

</fieldset>

<fieldset style="float:right; margin-right: 5px;">
<legend>间距</legend>

<div class="space"></div>

<div class="fr">单元格间距:</div>
<input type="text" name="spacing" id="f_spacing" size="5" value="1">

<p />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<div class="fr">单元格边距:</div>
<input type="text" name="padding" id="f_padding" size="5" value="1">

<div class="space"></div>

</fieldset>

<div style="margin-top: 85px; border-top: 1px solid #999; padding: 2px; text-align: right;">
<button type="button" name="ok" onclick="return onOK();">确定</button>
<button type="button" name="cancel" onclick="return onCancel();">取消</button>
</div>

</form>

</body>
</html>
